package com.example.unisys.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.unisys.dao.ExamMapper;
import com.example.unisys.entity.Examination;
import com.example.unisys.form.ExaminationForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;

@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class ExaminationService extends ServiceImpl<ExamMapper,Examination> {


//    public int deleteByPrimaryKey(Integer test_id) {
//        return baseMapper.deleteByPrimaryKey(test_id);
//    }

//    int insert(Examination record) {
//        return baseMapper.insert(record);
//    }

//    public int insertSelective(Examination record) {
//        return baseMapper.insert(record)
////        return baseMapper.insertSelective(record);
//    }

//    Examination selectByPrimaryKey(Integer test_id) {
//        return baseMapper.selectByPrimaryKey(test_id);
//    }
//
//     public int updateByPrimaryKeySelective(Examination record) {
//
//        return baseMapper.updateByPrimaryKeySelective(record);
//    }
//
//    int updateByPrimaryKey(Examination record) {
//        return baseMapper.updateByPrimaryKey(record);
//    }

    public List<ExaminationForm> getAllExams(HashMap<String, Object> hs) {
        return baseMapper.getAllExams(hs);
    }

//    public int deleteExam(HashMap<String, Object> hs) {
//        return baseMapper.deleteExam(hs);
//    }

    public Examination getExamById(HashMap<String, Object> hs) {
        return baseMapper.getExamById(hs);
    }

    public int getExamSum() {
        return baseMapper.selectCount(new QueryWrapper<>());
//        return baseMapper.getExamSum();
    }

    public Examination getExamByTypeId(HashMap<String, Object> hs) {
        return baseMapper.getExamByTypeId(hs);
    }
}
